package com.hwf.springboot;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class WebServerAutoConfiguration implements AutoConfiguration{
    @Bean
    //条件注解
    @ConditionalOnClass("org.apache.catalina.startup.Tomcat") //如何判断Tomcat依赖存不存在呢？判断有没有Tomcat依赖中的某个具体的类即可
    public TomcatWebServer tomcatWebServer(){
        return new TomcatWebServer();
    }

    @Bean
    @ConditionalOnClass("org.eclipse.jetty.server.Server")
    public JettyWebServer jettyWebServer(){
        return new JettyWebServer();
    }
}
